package pw.goyd.game.handler.imp;

import pw.goyd.game.handler.Handler;
import pw.goyd.game.logic.DeclarerRequest;
import pw.goyd.game.server.Log;
import pw.goyd.game.server.LoginList;
import pw.goyd.subscribe.PlayerCustomer;

public class DECLARER extends Handler {
    /**
     * 完成积分
     */
    @Override
    public void handle() {
        // 读设定庄家倍数
        DeclarerRequest declarerRequest = new DeclarerRequest();
        declarerRequest.readFromBytes(request.getData());
        int declarer = declarerRequest.getDeclarer();
        PlayerCustomer declarerPlayer = LoginList.getPlayer(ctx
                .getChannel().getId());                 // 设置抢庄分数
        if (declarerPlayer != null) {
            declarerPlayer.setDeclarer(declarer);
            declarerPlayer.sendDeclarer();              // 推送到房间
        } else {
            Log.getLogger().error("空指针--->ChannelID[" + ctx.getChannel().getId() + "]");
        }


    }


}
